package org.jtrace;

import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;

import org.jtrace.geometry.GeometricObject;
import org.jtrace.primitives.ColorRGB;
import org.jtrace.primitives.ReflectanceCoefficient;

public abstract class Texture extends Material {
	
	BufferedImage img;

	public Texture(String texturePath, ColorRGB color, ReflectanceCoefficient kAmbient, ReflectanceCoefficient kDiffuse) {
		super(color, kAmbient, kDiffuse);
		loadTexture(texturePath);
	}

	public Texture(String texturePath, ColorRGB color, ReflectanceCoefficient kAmbient, ReflectanceCoefficient kDiffuse, ReflectanceCoefficient kSpecular) {
		super(color, kAmbient, kDiffuse, kSpecular);
		loadTexture(texturePath);
	}
	
	public void loadTexture(String texturePath) {
		try {
			img = ImageIO.read(new File(texturePath));
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	public abstract ColorRGB getColor(Hit hit, Jay jay, GeometricObject object);

}
